package com.ysyc.driver_ee.adapter;

import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.ysyc.driver_ee.R;
import com.ysyc.driver_ee.activity.OrderDetailsActivity;
import com.ysyc.driver_ee.base.BaseAdapter;
import com.ysyc.driver_ee.model.OrderForm;
import com.ysyc.driver_ee.tools.DateUtils;
import com.ysyc.driver_ee.tools.StatusSettingUtils;

import butterknife.BindView;

/**
 * <p>描述：(这里用一句话描述这个类的作用)</p>
 * 作者： Chan<br>
 * 日期： 2018/11/10 21:00<br>
 * 版本： v1.0<br>
 */
public class OrderCompletedAdapter extends BaseAdapter<OrderForm> {

    public OrderCompletedAdapter(Activity activity, int layoutView) {
        super(activity, layoutView);
    }

    @Override
    public void convert(MyViewHolder holder, OrderForm item) {
        View itemView = holder.itemView;
        ImageView ivDriverView =itemView.findViewById(R.id.iv_driver_view);
        TextView tvNameView =itemView.findViewById(R.id.tv_name_view);
        TextView tvStatusView= itemView.findViewById(R.id.tv_status_view);
        LinearLayout llTopView= itemView.findViewById(R.id.ll_top_view);
        TextView tvTimeServiceView =itemView.findViewById(R.id.tv_time_service_view);
        TextView tvPriceView =itemView.findViewById(R.id.tv_price_view);
        TextView tvStartingPointView =itemView.findViewById(R.id.tv_starting_point_view);
        TextView tvEndPointView =itemView.findViewById(R.id.tv_end_point_view);
        TextView tvLocationView =itemView.findViewById(R.id.tv_location_view);
        TextView tvProjectView= itemView.findViewById(R.id.tv_project_view);
        TextView tvProjectExplanationView=itemView.findViewById(R.id.tv_project_explanation_view);
        RelativeLayout rlOrderDetailsView= itemView.findViewById(R.id.rl_order_details_view);
        tvNameView.setText(item.deliveryName);
        StatusSettingUtils.setTransportStatus(tvStatusView,item.transportStatus);
        tvProjectView.setText(item.projectName);
        tvTimeServiceView.setText(DateUtils.orderTime(item.startArriveTime));
        tvPriceView.setText("¥"+item.price/100);
        tvStartingPointView.setText(item.startName);
        tvEndPointView.setText(item.endName);
        tvLocationView.setText("当前位置:"+item.driverMapName);

        itemView.setOnClickListener(v -> {
            Intent intent = new Intent(mActivity,OrderDetailsActivity.class);
            intent.putExtra("orderNumber",item.orderNumber);
            mActivity.startActivity(intent);

        });

    }





}
